<form action="<{link app=b2c ctl='site_passport' act='create' args01=$next_url}>" method="post">
  <input name="forward" type="hidden" value="<{$options.url}>">
  <input name="mini" type="hidden" value="<{$mini_passport}>">
  <ul>
	<li class="form-item" style="height:25px">
		<label for="" class="form-label"><em class="warn">*</em><{t}>注册账号：<{/t}></label>
		<span class="form-act">
			<input type="radio" name="reg_style" value="0" checked="checked" id="em" onclick="javascript:$(reg_email).setStyle('display','block');$(reg_phone).setStyle('display','none');$$('.action-mobile-verify').setStyle('display','none');$(e).set('value','')"><label for="em" style="display:inline-block;width:120px;cursor:pointer"><{t}>邮箱<{/t}></label>
			<input type="radio" name="reg_style" value="1" id="te" onclick="javascript:$(reg_email).setStyle('display','none');$(reg_phone).setStyle('display','block');$$('.action-email-verify').setStyle('display','none');$$('.action-verifycode').setStyle('display','block');$(check_tel).set('value','');"><label for="te" style="display:inline-block;width:160px;cursor:pointer"><{t}>手机<{/t}></label>
		</span>
	</li>
	<li class="form-item" id="reg_email">
		<label for="" class="form-label"></label>
		<span class="form-act"><{input id="e" type="text" signup_type="email" name="pam_account[login_name]" class="action-account-check" placeholder=$___b2c="邮箱"|t:'b2c' vtype="required&&email" data-caution=$___b2c="请填写登录帐号，最少4个字符"|t:'b2c' autofocus}><span class="validation-messagebox"></span></span>
	</li>
	<li class="form-item reg_phone" style="display:none; height:65px;"  id="reg_phone">
		<label for="" class="form-label"></label>
		<span class="form-act">
		<{if $phones}>
			<!--手机验证-->
			<select name="pam_account[phone_setting]" id="quhao" style="border: 1px solid #ccc;padding: 10px;">
				<{foreach from=$phones item=items}>
				<option sid="<{$items.length}>" value="<{$items.area}>"><{$items.country}><{$items.area}></option>
				<{/foreach}>
			</select>
			<{input type="text" name="pam_account[login_mobile]" signup_type="mobile"  placeholder=$___b2c="请填写手机号"|t:'b2c' vtype="required" style="width:180px;" id="check_tel" class="action-account-check"}>
			<span  style="color:red" class="validation-messagebox" id="phoneid"></span>
		<{else}>
			<{input type="text" name="pam_account[login_mobile]" signup_type="mobile"  placeholder=$___b2c="请填写手机号"|t:'b2c' id="check_tel" class="action-account-check"}>
			<span  style="color:red" class="validation-messagebox" id="phoneid"></span>
		<{/if}>
		</span>
	</li>
	<li class="form-item area">
		<label for="" class="form-label"><em class="warn">*</em><{t}>地区：<{/t}></label><span class="form-act"><{input type="region" name="area" required="true"  app="ectools" callback="selectArea"}></span>
	</li>
	<li class="form-item">
      <label for="" class="form-label"><em class="warn">*</em><{t}>姓名：<{/t}></label><span class="form-act"><{input type="text" name="name" id=""  placeholder=$___b2c="公司或者个人姓名"|t:'b2c' vtype="required" }><span></span></span>
    </li>
    <li class="form-item">
    <label for="" class="form-label"><em class="warn">*</em><{t}>密码：<{/t}></label><span class="form-act"><{input type="password" name="pam_account[login_password]" maxlength="20" placeholder=$___b2c="6-20个字符"|t:'b2c' vtype="required&&minLength:6&&maxLength:20" data-caution=$___b2c="请填写密码，6-20个字符&&输入不正确，最少6个字符&&输入不正确，最多20个字符"|t:'b2c' check='true'}></span>
    </li>
    <li class="form-item">
    <label for="" class="form-label"><em class="warn">*</em><{t}>确认密码：<{/t}></label><span class="form-act"><{input type="password" name="pam_account[psw_confirm]" id="" class="x-input" maxlength="20" placeholder=$___b2c="再次填写密码"|t:'b2c' vtype="equal:pam_account[login_password]" data-caution=$___b2c="密码与确认密码不相符，请重新填写"|t:'b2c'}><span class="validation-messagebox"></span></span>
    </li>
    <{foreach from=$attr item=item name="item" key='row'}>
    <li class="form-item">
    <label for="" class="form-label"><{if $item.attr_required eq 'true'}><em class="warn">*</em><{/if}><{$item.attr_name}>：</label>
    <span class="form-act">
      <{if $item.attr_type =='date'}>
        <{if $item.attr_value != '0-0-0'}>
          <{assign var=value value=$item.attr_value}>
        <{/if}>
        <{if $item.attr_required eq 'true'}>
          <{assign var=vtype value="required"}>
        <{/if}>
        <!-- datepicker滚动定位问题 -->
        <{if $mini_passport == true}>
          <{assign var=options value="{inject:'mini_signup'}"}>
        <{/if}>
        <{input type="datepicker" data-calendar-options=$options vtype=$vtype name=$item.attr_column value=$value}>
      <{/if}>

      <{if $item.attr_type =='region'}>
      <{if $item.attr_required eq 'true'}>
      <{input app=ectools type="region" name=$item.attr_column value=$item.attr_value vtype="area"}>
      <{else}>
      <{input app=ectools type="region" name=$item.attr_column value=$item.attr_value}>
      <{/if}>
      <{/if}>

      <{if $item.attr_type =='gender'}>
      <{input type='gender' name=$item.attr_column value=$item.attr_value}>
      <{/if}>

      <{if $item.attr_type =='select'}>
      <select name="<{$item.attr_column}>" class="x-select" <{if $item.attr_required eq 'true'}>vtype="required"<{/if}>>
        <option value="" <{if $item.attr_value == ''}>selected="selected"<{/if}>><{t}>请选择<{/t}></option>
        <{foreach from=$item.attr_option item=option name="option"}>
        <option value="<{$option}>" <{if $item.attr_value == $option}>selected="selected"<{/if}>><{$option}></option>
        <{/foreach}>
      </select>
      <{/if}>

      <{if $item.attr_type =='checkbox'}>
      <{foreach from=$item.attr_option item=checkbox name="checkbox" }>
      <input type="checkbox" name="box:<{$item.attr_column}>[]" value="<{$checkbox}>"<{if $item.attr_required eq 'true' && $smarty.foreach.checkbox.iteration==1}> vtype="onerequired"<{/if}> <{foreach from=$item.attr_value item=checkboxvalue name="checkboxvalue" }><{if $checkboxvalue==$checkbox}>checked="checked"<{/if}><{/foreach}>>
      <label><{$checkbox}></label>
      <{/foreach}>
      <input type="hidden" name="<{$item.attr_column}>[]" value="%no%">
      <{/if}>

      <{if $item.attr_type == 'text' || $item.attr_type == 'number' || $item.attr_type == 'alpha'}>
      <input type="text" class="x-input" name="<{$item.attr_column}>" value="<{$item.attr_value}>" vtype="<{if $item.attr_required eq 'true'}>required<{/if}><{if $item.attr_valtype}><{if $item.attr_required eq 'true'}>&&<{/if}><{$item.attr_valtype}><{/if}>" />
      <{/if}>
    </span>
    </li>
    <{/foreach}>
    <{if $valideCode == 'true' || $site_sms_valide == 'true' }>
    <li class="form-item action-verifycode" <{if $valideCode == 'false' && $site_sms_valide == 'true' }> style="display:none" <{/if}> >
      <label for="" class="form-label"><em class="warn">*</em><{t}>验证码：<{/t}></label>
      <span class="form-act">
        <{input type="vcode" name="signupverifycode" class="verify-input" placeholder=$___b2c="填写验证码"|t:'b2c' data-caution=$___b2c="请正确填写验证码"|t:'b2c' key='LOGINVCODE' a_class="lnklike"}>
      </span>
    </li>
    <{/if}>
    <li class="form-item action-email-verify" style="display:none;">
      <label for="" class="form-label"><{t}>验证码：<{/t}></label>
      <span class="form-act">
        <{input type="text" name="vcode" id="" vtype="required" class="verify-input"}> <a href="<{link app=b2c ctl=site_passport act=send_vcode_email2}>" class="btn btn-caution action-get-verifycode"><span><span><{t}>获取邮箱验证码<{/t}></span></span></a>
      </span>
    </li>
	<li class="form-item action-mobile-verify" style="display:none;">
      <label for="" class="form-label"><{t}>短信验证码：<{/t}></label>
      <span class="form-act">
		<{input type="text" name="m_vcode" id="" vtype="required" class="verify-input"}> <a href="<{link app=b2c ctl=site_passport act=send_vcode_sms}>" class="btn btn-caution action-get-verifycode"><span><span><{t}>获取短信验证码<{/t}></span></span></a>
      </span>
    </li>
    <li class="form-item-normal">
      <label for="" class="form-label"></label>
      <span class="form-act">
        <input type="checkbox" name="license" id="" class="x-check" vtype="onerequired" data-caution="<{t}>请选择同意<{/t}>" checked="checked">
        <label for="" class="form-sub-label" style="width:78%; float:right;"> <{t}>我已阅读并同意<{/t}> <a href="<{link app=b2c ctl=site_passport act=license }>" class="lnklike" target="_blank"><{t}>会员注册协议<{/t}></a> <{t}>和<{/t}> <a href="<{link app=b2c ctl=site_passport act=privacy }>" class="lnklike" target="_blank"><{t}>隐私保护政策<{/t}></a></label>
        <span class="validation-messagebox"></span>
      </span>
    </li>
    <li class="form-item-normal">
      <label for="" class="form-label"></label>
      <span class="form-act">
        <{assign var='label' value=$___b2c='注册'|t:'b2c'}>
        <{button id="btn1" type="submit" class="btn-major btn-big" label=$__b2c=$label|t:'b2c' rel="_request"}>
      </span>
    </li>
  </ul>
</form>
<script>
window.addEvent('domready',function(){
	
	$("check_tel").addEvent('blur',function(){
		var str = this.get('value').trim();
		var obj = $$("#quhao option:selected");
		var num = obj[0].get('sid');
		var reg = new RegExp("^[1-9]\\d{"+(num-1)+"}$");
		
		if(str.length!=0){
			if(!reg.test(str)){
				$("phoneid").set('html','<{t}>手机格式错误<{/t}>');
			}else{
				$("phoneid").set('html','');
			}
		}
	});

	$("quhao").addEvent('change',function(){
		$('check_tel').set('value','');
	});
});

$("btn1").addEvent('click', function(e){
	var str = $('check_tel').get('value').trim();
//	var num = $('check_tel').getPrevious('select').get('sid');
	var obj = $$("#quhao option:selected");
	var num = obj[0].get('sid');
	var reg = new RegExp("^[1-9]\\d{"+(num-1)+"}$");

	if(str.length!=0){
		if(!reg.test(str)){
			$("phoneid").set('html','<{t}>手机格式错误<{/t}>');
			e.stop();
		}else{
			$("phoneid").set('html','');
		}
	}
});
</script>